<?php

namespace app\admin\model\kefu;

use think\Model;
use think\model\relation\BelongsTo;

/**
 * Session
 */
class Session extends Model
{
    // 表名
    protected $name = 'kefu_session';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = true;
    protected $updateTime         = false;

    // 字段类型转换
    protected $type = [
        'delete_time' => 'timestamp:Y-m-d H:i:s',
    ];


    public function user(): BelongsTo
    {
        return $this->belongsTo(User::class, 'user_id', 'id');
    }

    public function sessionUser(): BelongsTo
    {
        return $this->belongsTo(User::class, 'session_user_id', 'id');
    }
}